/*
 * Copyright (c) 2024 huipei.x
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.xphsc.kubernetes.core.query;
/**
 * {@link }
 * @author <a href="xiongpeih@163.com">huipei.x</a>
 * @description: Read Pod Logs Query
 * @since 1.0.3
 */
public class ReadPodLogQuery {
    /**
     * namespace object name and auth scope, such as for teams and projects (required)
     */
    private String namespace;
    /**
     * name name of the Pod (required)
     */
    private String name;
    /**
     * The container for which to stream logs. Defaults to only container if there is
     *  one container in the pod. (optional)
     */
    private String container;
    /**
     * Follow the log stream of the pod. Defaults to false. (optional)
     */
    private Boolean follow;
    /**
     * insecureSkipTLSVerifyBackend insecureSkipTLSVerifyBackend indicates that the apiserver
     *should not confirm the validity of the serving certificate of the backend it is connecting
     *  to. This will make the HTTPS connection between the apiserver and the backend insecure.
     * This means the apiserver cannot verify the log data it is receiving came from the real
     * kubelet. If the kubelet is configured to verify the apiserver&#39;s TLS credentials, it
     * does not mean the connection to the real kubelet is vulnerable to a man in the middle
     *  attack (e.g. an attacker could not intercept the actual log data coming from the real
     *   kubelet). (optional)
     */
    private Boolean insecureSkipTLSVerifyBackend;
    /***
     * If set, the number of bytes to read from the server before terminating the
     *  log output. This may not display a complete final line of logging, and may return slightly
     * more or slightly less than the specified limit. (optional)
     */
    private Integer limitBytes;
    /**
     * pretty If &#39;true&#39;, then the output is pretty printed. (optional)
     */
    private  String pretty;
    /**
     * Return previous terminated container logs. Defaults to false. (optional)
     */
    private Boolean previous;
    /**
     *  A relative time in seconds before the current time from which to show logs.
     *  If this value precedes the time a pod was started, only logs since the pod start will be
     *   returned. If this value is in the future, no logs will be returned. Only one of
     *  sinceSeconds or sinceTime may be specified. (optional)
     */
    private Integer sinceSeconds;
    /**
     *  If set, the number of lines from the end of the logs to show. If not
     * specified, logs are shown from the creation of the container or sinceSeconds or sinceTime
     *   (optional)
     */
    private Integer tailLines;
    /**
     * If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every
     * line of log output. Defaults to false. (optional)
     */
    private Boolean timestamps;


    public static ReadPodLogQuery.Builder builder() {
        return new ReadPodLogQuery.Builder();
    }

    private ReadPodLogQuery(ReadPodLogQuery.Builder builder) {
        this.namespace = builder.namespace;
        this.name = builder.name;
        this.container = builder.container;
        this.follow = builder.follow;
        this.insecureSkipTLSVerifyBackend = builder.insecureSkipTLSVerifyBackend;
        this.limitBytes = builder.limitBytes;
        this.pretty = builder.pretty;
        this.previous = builder.previous;
        this.sinceSeconds = builder.sinceSeconds;
        this.tailLines = builder.tailLines;
        this.timestamps = builder.timestamps;
    }


    public static class Builder {
        private String namespace;
        private String name;
        private String container;
        private Boolean follow;
        private Boolean insecureSkipTLSVerifyBackend;
        private Integer limitBytes;
        private  String pretty;
        private Boolean previous;
        private Integer sinceSeconds;
        private Integer tailLines;
        private Boolean timestamps;

        public Builder() {
        }
        /**
         * namespace object name and auth scope, such as for teams and projects (required)
         */
        public <T> ReadPodLogQuery.Builder namespace(String namespace) {
            this.namespace = namespace;
            return this;
        }
        /**
         * name name of the Pod (required)
         */
        public <T> ReadPodLogQuery.Builder name(String name) {
            this.name = name;
            return this;
        }
        /**
         * The container for which to stream logs. Defaults to only container if there is
         *  one container in the pod. (optional)
         */
        public <T> ReadPodLogQuery.Builder container(String container) {
            this.container = container;
            return this;
        }
        /**
         * Follow the log stream of the pod. Defaults to false. (optional)
         */
        public <T> ReadPodLogQuery.Builder follow(Boolean follow) {
            this.follow = follow;
            return this;
        }
        /**
         * insecureSkipTLSVerifyBackend insecureSkipTLSVerifyBackend indicates that the apiserver
         *should not confirm the validity of the serving certificate of the backend it is connecting
         *  to. This will make the HTTPS connection between the apiserver and the backend insecure.
         * This means the apiserver cannot verify the log data it is receiving came from the real
         * kubelet. If the kubelet is configured to verify the apiserver&#39;s TLS credentials, it
         * does not mean the connection to the real kubelet is vulnerable to a man in the middle
         *  attack (e.g. an attacker could not intercept the actual log data coming from the real
         *   kubelet). (optional)
         */
        public <T> ReadPodLogQuery.Builder insecureSkipTLSVerifyBackend(Boolean insecureSkipTLSVerifyBackend) {
            this.insecureSkipTLSVerifyBackend = insecureSkipTLSVerifyBackend;
            return this;
        }
        /***
         * If set, the number of bytes to read from the server before terminating the
         *  log output. This may not display a complete final line of logging, and may return slightly
         * more or slightly less than the specified limit. (optional)
         */
        public <T> ReadPodLogQuery.Builder limitBytes(Integer limitBytes) {
            this.limitBytes = limitBytes;
            return this;
        }
        /**
         * pretty If &#39;true&#39;, then the output is pretty printed. (optional)
         */
        public <T> ReadPodLogQuery.Builder pretty(String pretty) {
            this.pretty = pretty;
            return this;
        }
        /**
         * Return previous terminated container logs. Defaults to false. (optional)
         */
        public <T> ReadPodLogQuery.Builder previous(Boolean previous) {
            this.previous = previous;
            return this;
        }
        /**
         *  A relative time in seconds before the current time from which to show logs.
         *  If this value precedes the time a pod was started, only logs since the pod start will be
         *   returned. If this value is in the future, no logs will be returned. Only one of
         *  sinceSeconds or sinceTime may be specified. (optional)
         */
        public <T> ReadPodLogQuery.Builder sinceSeconds(Integer sinceSeconds) {
            this.sinceSeconds = sinceSeconds;
            return this;
        }
        /**
         *  If set, the number of lines from the end of the logs to show. If not
         * specified, logs are shown from the creation of the container or sinceSeconds or sinceTime
         *   (optional)
         */
        public <T> ReadPodLogQuery.Builder tailLines(Integer tailLines) {
            this.tailLines = tailLines;
            return this;
        }
        /**
         * If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every
         * line of log output. Defaults to false. (optional)
         */
        public <T> ReadPodLogQuery.Builder timestamps(Boolean timestamps) {
            this.timestamps = timestamps;
            return this;
        }




        public ReadPodLogQuery build() {
            return new ReadPodLogQuery(this);
        }
    }
    public String namespace() {
        return namespace;
    }

    public String name() {
        return name;
    }

    public String container() {
        return container;
    }

    public Boolean follow() {
        return follow;
    }

    public Boolean insecureSkipTLSVerifyBackend() {
        return insecureSkipTLSVerifyBackend;
    }

    public Integer limitBytes() {
        return limitBytes;
    }

    public String pretty() {
        return pretty;
    }

    public Boolean previous() {
        return previous;
    }

    public Integer sinceSeconds() {
        return sinceSeconds;
    }

    public Integer tailLines() {
        return tailLines;
    }

    public Boolean timestamps() {
        return timestamps;
    }
}
